import java.util.Scanner;

public class IfExample1{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);    
		boolean validGrade = true;      
      double grade; char letterGrade = 'A';
      System.out.println("Enter numeric grade [0 - 100]: ");
      grade = scanner.nextDouble();
      if(grade < 0.0 || grade > 100.0)
               validGrade = false;    
      else if(grade >= 85.0)
          letterGrade = 'A';
      else if(grade >= 75.0)
           letterGrade = 'B';
      else if(grade >= 65.0) 
           letterGrade = 'C';
      else if(grade >= 45.0)
           letterGrade = 'D';
      else
           letterGrade = 'F';
      
      if(validGrade)
         System.out.printf("The letter grade is %c", letterGrade);
      else
         System.out.println("Error: Invalid grade");
	}
}	
	